﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class RecordPrefab : MonoBehaviour
{
    public Text ranking;
    public Text playerData;

    public void SetupRecordPrefab(PlayerData pd , int index)
    {
        switch (index.ToString())
        {
            case "0":
                ranking.text = "1st";
                break;
            case "1":
                ranking.text = "2nd";
                break;
            case "2":
                ranking.text = "3rd";
                break;
            case "3":
                ranking.text = "4th";
                break;
            case "4":
                ranking.text = "5th";
                break;
            default:
                break;
        }
        int min = (int)(pd.playerRecord / 60);
        float sec = pd.playerRecord % 60;
        
        string record = min.ToString("00") + " : " + sec.ToString("00");
        playerData.text = pd.playerName + " : " + record;
    }
    
}
